Page({
  data: {
    imgUrl: ''
  },
  onLoad(query) {
    wx.getLocation({
      type: 'wgs84',
      success (res) {
        console.log(res)
        const latitude = res.latitude
        const longitude = res.longitude
        const speed = res.speed
        const accuracy = res.accuracy
      }
    })
  },
  showAction() {
    const self = this
    wx.showActionSheet({
      alertText: "提醒",
      itemList: ['拍照', '相册', '云端'],
      itemColor: "#0f0",
      success (res) {
        if(res.tapIndex === 1) {
          wx.chooseImage({
            count: 1,
            sizeType: ['original', 'compressed'],
            sourceType: ['album', 'camera'],
            success (res) {
              self.setData({
                imgUrl: res.tempFilePaths
              })
              console.log(res.tempFilePaths)
              wx.getImageInfo({
                src: res.tempFilePaths[0],
                success (res) {
                  console.log(res)
                  console.log(res.width)
                  console.log(res.height)
                }
              })
            }
          })
        }
      },
      fail (res) {
        console.log(res.errMsg)
      }
    })
  },
  chooseLocation() {
    /*wx.chooseLocation({
      // latitude: 35.5943306020002,
      // longitude: 109.26598575112915,
      success(res) {
        console.log(res)
      },
      fail(e) {
        console.log(e)
      }
    })*/
    wx.chooseLicensePlate({
      success(res) {
        console.log(res)
      },
      fail(e) {
        console.log(e)
      }
    })
  }
})
